<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Control.php');
require_once($Config->WebCMSRoot.'Models/Header.php');
require_once($Config->WebCMSRoot.'Views/Header.php');

Class Header extends BaseControl
{
	var $header;
	var $view;
	
	function Header($parameters, &$page)
	{
		$this->header  = new HeaderModel();
		$this->view    = new HeaderView();
		
		parent::BaseControl($parameters, &$page);
//if ($this->page->IsDebug) { print('<pre>'.var_export($this, true).'</pre>');exit; }
	}

	function Execute()
	{
//if ($this->page->IsDebug) { print('<pre>'.var_export($this->parameters, true).'</pre>');exit; }
		$this->header->Retrieve(&$this->parameters);
//if ($this->page->IsDebug) { print('<pre>'.var_export($this->header, true).'</pre>');exit; }

		switch (count($this->header->Collection))
		{
			case 1:
				$this->view->ShowHeader(&$this->header->Collection[0]);
				break;
				
			case 0:
				$this->view->ShowHeader(&$this->header);
				break;
		}
		
		parent::Execute();
	}

	function ValidateArguments()
	{
		return (count($this->parameters) >= 1);
	}
}
?>